//
//  jiFenModel.m
//  SoundPill
//
//  Created by 宋旭东 on 16/1/7.
//  Copyright © 2016年 宋旭东. All rights reserved.
//

#import "jiFenModel.h"
#import "UIViewExt.h"
#import "AFNetworking.h"
#import "JCAlertView.h"

@interface jiFenModel ()
@property (strong, nonatomic) JCAlertView *alert;

@end

@implementation jiFenModel
- (void)showJiFen:(My_ViewController *)controller
{
    NSString *url = @"http://123.57.1.143/api/getscore";
    NSString *requestheader = [NSString stringWithFormat:@"Token %@:%@",[[NSUserDefaults standardUserDefaults] valueForKey:@"uid"], [[NSUserDefaults standardUserDefaults] valueForKey:@"token"]];
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/html", @"text/plain", nil];
    [manager.requestSerializer setValue:requestheader forHTTPHeaderField:@"authorization"];
    [manager GET:url parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        [controller showJifenAlert:responseObject];
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
    }];
}

@end
